﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VideoClassLibrary.Model;
using VideoClassLibrary.BusinessLogicLayer;
using System.Data;

public partial class NewsCategoryManager_UpdateNewsCategory : System.Web.UI.Page
{
    NewsCategoryModule ncm;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            QuaryNewsCategorybyNewsId();
        }
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        V_NewsCategory ncg = new V_NewsCategory();
        ncg.ID = Convert.ToInt32(Request.QueryString["Nid"]);
        ncg.Title = this.txtTitle.Text.ToString();
        ncg.Description = this.txtDescription.Text.ToString();
        ncg.Updatetime = DateTime.Now;
        ncm = new NewsCategoryModule();
        ncm.UpdateNewsCategory(ncg);
        Response.Redirect("ViewNewsCategory.aspx");

    }
    private void QuaryNewsCategorybyNewsId()
    {

        V_NewsCategory ncg = new V_NewsCategory();
        int id =Convert.ToInt32(Request.QueryString["Nid"]);
        ncm = new NewsCategoryModule();
        ncg= ncm.QueryNewsCategoryById(id);
        txtTitle.Text = ncg.Title.ToString();
        txtDescription.Text = ncg.Description.ToString();
    }
    protected void butreturn_Click(object sender, EventArgs e)
    {
        Response.Redirect("ViewNewsCategory.aspx");
    }
}
